﻿using mdgame.Core;
using mdgame.Core.Scene_3;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Handlers;
using Plugin.Maui.Audio;

namespace mdgame;

public partial class MainPage : ContentPage
{
    Game game;
    public MainPage(IAudioManager audioManager)
    {
        InitializeComponent();
    
        game = new Scene3(ghv, audioManager);

        ghv.Drawable = game;

        // 添加TapGestureRecognizer
        var tapGestureRecognizer = new TapGestureRecognizer();
        tapGestureRecognizer.Tapped += game.Tapped;
        this.ghv.GestureRecognizers.Add(tapGestureRecognizer);

        // 添加PanGestureRecognizer
        var panGestureRecognizer = new PanGestureRecognizer();
        panGestureRecognizer.PanUpdated += game.PanUpdated;
        this.ghv.GestureRecognizers.Add(panGestureRecognizer);
    }
}

